#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
string s;
int main()
{
    string a;
    cin >> a;
    string s = a;
    sort(s.begin(), s.end(), greater<char>());
    string ret;
    ret += s[0];
    for (int i = 1; i < s.size(); i++)
    {
        if (s[i] == s[i - 1]) continue;
        ret += s[i];
    }
    // cout << ret;
    string ret1;
    for (auto c : a)
    {
        ret1 += to_string(ret.find(c));
    }

    string r1;
    r1 += "int[] arr = new int[]{";
    for (auto& ch : ret) r1 += ch , r1 += ",";
    r1 .pop_back();
    r1 += "};";
    string r2;
    r2 += "int[] index = new int[]{";
    for (auto& c : ret1) r2 += c, r2 += ",";
    r2.pop_back();
    r2 += "};";
    cout << r1 << endl;
    cout << r2 << endl;

    return 0;
}